#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "dept150_chol_mgpu_ck.h"
#include "dept150_common.h"

int main(int argc, char** argv)
{
	double* A = NULL;
	int i, j;
	int N = 6;
	int block_size = 3;
	if(argc >=  2)
	{
		N = atoi(argv[1]);
		block_size = atoi(argv[2]);
	}	
	A = (double*)malloc(N*N*sizeof(double));
	for(i = 0; i < N; ++i)
	{    
		for(j = 0; j < N; ++j)
        {       
            A[IDF2(i,j,N)] = i>j? (N- i):(N - j);
        }
	}
	int n = N;
	int info = -10;
	/*for(int i = 0; i < N; i++)
	{
		for(int j = 0; j < N; j++)
		{
			printf("   %.5e", A[IDF2(i,j, N)]);
		}
		printf("\n");
	}*/
	//print_matrix(N, N, A, N);
	printf("!!!!!!!!!!!!!!!!!!\n");
	clock_t start_time, end_time;
	start_time = clock();
	double *b;
	int res = LPPSADB_cu_multi_gpu_ck(block_size, n, A, b, b, b, b, 0.0, 0.0);	
	end_time = clock();
	for(int i = n - 10; i<n; i++)
	{
		printf(" %g ", A[IDF2(n-1, i, n)]);
	}
	printf("\n");
#ifdef DETAIL_DEBUG
	printf("!!!!!\n");
	if( res == 0)
	{
		print_matrix(N, N, A, N);
	}
#endif
	printf("\nTime : %.5f\n",(float)(end_time - start_time)/CLOCKS_PER_SEC);
	
}

